package com.commont;


import com.Util.Config;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.show.api.ShowApiRequest;
import lombok.extern.slf4j.Slf4j;

/**
 * 网盘通用工具
 */
@Slf4j
public class DiskComment {

    /**
     * 通过关键字搜索
     * @param fromDesc
     * @param current_page
     * @return
     */
    public static JsonObject getDisk(String fromDesc,String current_page) throws Exception{
        String res=new ShowApiRequest("http://route.showapi.com/921-1", Config.YU_appid,Config.YU_secret)
                .addTextPara("q",fromDesc)
                .addTextPara("page",current_page)
                .post();

        JsonObject jsonObject=new JsonParser().parse ( res ).getAsJsonObject ();
        return jsonObject;
    }

    public static void main(String[] args) {
        JsonObject jsonObject= null;
        try {
            jsonObject = getDisk ( "电锯惊魂","1" );
        } catch (Exception e) {
            e.printStackTrace ();
        }
    }
}
